package de.upb.aquarium.api.camera;

import javax.media.opengl.GL;

import de.upb.aquarium.World;
import de.upb.aquarium.api.utility.VectorDouble;


public class OrthogonalProjection implements IProjection {

	private VectorDouble lowerLeftCorner;
	private VectorDouble upperRightCorner;
	
	private double farClipping;
	private double nearClipping;
	
	public OrthogonalProjection(
			VectorDouble lowerLeftCorner,
			VectorDouble upperRightCorner,
			double farClipping,
			double nearClipping) {
		super();
		this.lowerLeftCorner = lowerLeftCorner;
		this.upperRightCorner = upperRightCorner;
		this.farClipping = farClipping;
		this.nearClipping = nearClipping;
	}

	@Override
	public void addProjectionMatrix() {
		GL gl = World.getInstance().getGL();
		
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glOrtho(
				lowerLeftCorner.data[0],
				upperRightCorner.data[0],
				lowerLeftCorner.data[1],
				upperRightCorner.data[1],
				nearClipping,
				farClipping);
	}

	public VectorDouble getLowerLeftCorner() {
		return lowerLeftCorner;
	}

	public void setLowerLeftCorner(VectorDouble lowerLeftCorner) {
		this.lowerLeftCorner = lowerLeftCorner;
	}

	public VectorDouble getUpperRightCorner() {
		return upperRightCorner;
	}

	public void setUpperRightCorner(VectorDouble upperRightCorner) {
		this.upperRightCorner = upperRightCorner;
	}

	public double getFarClipping() {
		return farClipping;
	}

	public void setFarClipping(double farClipping) {
		this.farClipping = farClipping;
	}

	public double getNearClipping() {
		return nearClipping;
	}

	public void setNearClipping(double nearClipping) {
		this.nearClipping = nearClipping;
	}
}
